// 工具函数库
export function formatDate(timestamp) {
    const date = new Date(timestamp);
    const year = date.getFullYear();
    let month = date.getMonth() + 1;
    let day = date.getDate();
    let hour = (date.getHours());
    let minute = (date.getMinutes());
    let second = (date.getSeconds());
    let weekArr = ["日", "一", "二", "三", "四", "五", "六"];
    let week = weekArr[date.getDay()];

    if (month < 10) {
        month = "0" + month;
    }
    if (day < 10) {
        day = "0" + day;
    }
    if (hour < 10) {
        hour = "0" + hour;
    }
    if (minute < 10) {
        minute = "0" + minute;
    }
    if (second < 10) {
        second = "0" + second;
    }

    return `${year}-${month}-${day} ${hour}:${minute}:${second} 星期${week}`;
}
